<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
		<script type="text/javascript" src="../js/jquery.js"></script>
		<script>
			$(function() {

				var ss = {
					selector: "table.sub tbody",
					opts: {
						canClosed: '<span class="glyphicon glyphicon-minus pull-right"></span>',
						canOpened: '<span class="glyphicon glyphicon-plus pull-right"></span>'
					},
					init: function(context) {
						var module = this;
						var $table = $(this.selector, context);
						//隐藏子类  data-parent!=0
						$("tr[data-parent!=0]", $table).hide();
						var $parent = $("tr[data-parent=0]", $table);
						$parent.each(function() {
							var $p = $(this);
							var $open = $(module.opts.canOpened);
							$(" td:first", $p).append($open);
							var $sub = $("tr[data-parent=" + $p.data("value") + "]", $table);
							$p.after($sub);
							$p.data("son", $sub);
							$open.on("click", function() {
								$p.data("son").toggle();
								$(this).toggleClass("glyphicon-minus", "glyphicon-plus");
							})
						});
					}
				}.init(document);

				var minesetting = {
					callback: {
						onClick: clickTree,
						onAsyncSuccess: treeReady
					},
					check: {
						enable: true,
						chboxType: {
							'Y': 'ps',
							'N': 'ps'
						}
					}
				};
				var optss = $("ul").data("options");
				var opts = {};
				if(opts) {

					console.info(optss);
					try {
						opts = eval('(' + optss + ')');
					} catch(Exception) {
						console.info(Exception);
						opts = {};
					}
				} else {
					opts = {};
				}
				console.info(JSON.stringify(opts));
				console.info(opts.callback)

			});

			function clickTree() {}

			function treeReady() {}
		</script>
	</head>

	<body>
		<div class="container">
			<div class="row">
				<div class="col-md-12">

					<ul id="treeDemo" class="ztree" style="width: 100%;" data-options="{callback:{onClick :clickTree,onAsyncSuccess:treeReady},check:{enable:true,chboxType:{ 'Y' : 'ps', 'N' : 'ps' }}}"></ul>

					<input class="test" id="a1" data-value="0" />

					<table class="table table-striped table-bordered table-hover sub">
						<thead>
							<tr class="text-center">
								<th><input type="checkbox" data-member="pks"></th>
								<th>名称</th>
								<th>备注</th>
								<th class="text-info">操作</th>
							</tr>
						</thead>

						<tbody>

							<tr class="info" data-value="1" data-parent="0">
								<td class="center"><input value="1" name="pks" type="checkbox"></td>
								<td>博客相关</td>
								<td>2</td>
								<td></td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="sub/1" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-info action-get" data-href="sub/0" data-toggle="tooltip" title="添加子模块">
											<i class="glyphicon glyphicon-plus"></i>
											<i class="action-param" data-key="pId" data-value="1"></i>
										</button>

										<button class="btn btn-xs btn-danger action-get" data-href="1/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="info" data-value="2" data-parent="0">
								<td class="center"><input value="2" name="pks" type="checkbox"></td>
								<td>在线考试</td>
								<td>3</td>
								<td></td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="sub/2" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-info action-get" data-href="sub/0" data-toggle="tooltip" title="添加子模块">
											<i class="glyphicon glyphicon-plus"></i>
											<i class="action-param" data-key="pId" data-value="2"></i>
										</button>

										<button class="btn btn-xs btn-danger action-get" data-href="2/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="info" data-value="3" data-parent="0">
								<td class="center"><input value="3" name="pks" type="checkbox"></td>
								<td>在线学习</td>
								<td>4</td>
								<td></td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="sub/3" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-info action-get" data-href="sub/0" data-toggle="tooltip" title="添加子模块">
											<i class="glyphicon glyphicon-plus"></i>
											<i class="action-param" data-key="pId" data-value="3"></i>
										</button>

										<button class="btn btn-xs btn-danger action-get" data-href="3/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="info" data-value="5" data-parent="0">
								<td class="center"><input value="5" name="pks" type="checkbox"></td>
								<td>测试</td>
								<td>0</td>
								<td></td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="sub/5" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-info action-get" data-href="sub/0" data-toggle="tooltip" title="添加子模块">
											<i class="glyphicon glyphicon-plus"></i>
											<i class="action-param" data-key="pId" data-value="5"></i>
										</button>

										<button class="btn btn-xs btn-danger action-get" data-href="5/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="info" data-value="9" data-parent="0">
								<td class="center"><input value="9" name="pks" type="checkbox"></td>
								<td>系统管理</td>
								<td>9</td>
								<td></td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="sub/9" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-info action-get" data-href="sub/0" data-toggle="tooltip" title="添加子模块">
											<i class="glyphicon glyphicon-plus"></i>
											<i class="action-param" data-key="pId" data-value="9"></i>
										</button>

										<button class="btn btn-xs btn-danger action-get" data-href="9/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="11" data-parent="1">
								<td class="center"><input value="11" name="pks" type="checkbox"></td>
								<td>博客文章</td>
								<td>1</td>
								<td>/console/blog/article/</td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="11" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="11/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="12" data-parent="1">
								<td class="center"><input value="12" name="pks" type="checkbox"></td>
								<td>博客分类</td>
								<td>0</td>
								<td>/console/blog/category/</td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="12" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="12/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="21" data-parent="2">
								<td class="center"><input value="21" name="pks" type="checkbox"></td>
								<td>题库管理</td>
								<td>1</td>
								<td>/questBank/list/</td>
								<td>批量删除,新增,修改,删除</td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="21" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="21/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="22" data-parent="2">
								<td class="center"><input value="22" name="pks" type="checkbox"></td>
								<td>试卷管理</td>
								<td>2</td>
								<td>/examOptition/list</td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="22" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="22/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="23" data-parent="2">
								<td class="center"><input value="23" name="pks" type="checkbox"></td>
								<td>我的试卷</td>
								<td>4</td>
								<td></td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="23" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="23/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="24" data-parent="2">
								<td class="center"><input value="24" name="pks" type="checkbox"></td>
								<td>历史考试</td>
								<td>3</td>
								<td>/HisExam/list/</td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="24" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="24/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="31" data-parent="3">
								<td class="center"><input value="31" name="pks" type="checkbox"></td>
								<td>课程管理</td>
								<td>1</td>
								<td></td>
								<td>修改,删除,批量删除,新增</td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="31" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="31/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="32" data-parent="3">
								<td class="center"><input value="32" name="pks" type="checkbox"></td>
								<td>课程列表</td>
								<td>2</td>
								<td></td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="32" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="32/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="33" data-parent="3">
								<td class="center"><input value="33" name="pks" type="checkbox"></td>
								<td>我的课程</td>
								<td>3</td>
								<td>/edu/onlearn/mycourse/</td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="33" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="33/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="34" data-parent="3">
								<td class="center"><input value="34" name="pks" type="checkbox"></td>
								<td>学习记录</td>
								<td>4</td>
								<td></td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="34" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="34/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="51" data-parent="5">
								<td class="center"><input value="51" name="pks" type="checkbox"></td>
								<td>测试页面</td>
								<td>0</td>
								<td>/console/test/test1/</td>
								<td>新增,修改,删除</td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="51" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="51/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="91" data-parent="9">
								<td class="center"><input value="91" name="pks" type="checkbox"></td>
								<td>用户管理</td>
								<td>1</td>
								<td>/console/system/user/</td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="91" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="91/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="92" data-parent="9">
								<td class="center"><input value="92" name="pks" type="checkbox"></td>
								<td>菜单管理</td>
								<td>2</td>
								<td>/console/system/menu/</td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="92" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="92/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="93" data-parent="9">
								<td class="center"><input value="93" name="pks" type="checkbox"></td>
								<td>角色管理</td>
								<td>3</td>
								<td>/console/system/role/</td>
								<td>修改,删除,新增</td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="93" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="93/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="94" data-parent="9">
								<td class="center"><input value="94" name="pks" type="checkbox"></td>
								<td>按钮管理</td>
								<td>4</td>
								<td>/console/system/btn/</td>
								<td>批量删除,新增,修改,删除</td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="94" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="94/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="95" data-parent="9">
								<td class="center"><input value="95" name="pks" type="checkbox"></td>
								<td>模块管理</td>
								<td>5</td>
								<td>/console/system/menu/</td>
								<td>批量删除,新增,修改,删除</td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="95" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="95/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="96" data-parent="9">
								<td class="center"><input value="96" name="pks" type="checkbox"></td>
								<td>编码字典</td>
								<td>6</td>
								<td>/console/system/code/</td>
								<td>新增,修改,删除,批量删除</td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="96" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="96/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

							<tr class="text-center" data-value="97" data-parent="9">
								<td class="center"><input value="97" name="pks" type="checkbox"></td>
								<td>组织机构</td>
								<td>6</td>
								<td>/console/system/dept/</td>
								<td></td>
								<td class="text-center">
									<div class="btn-group btn-group-dis">

										<a class="btn btn-xs btn-success " href="97" data-toggle="tooltip" title="编辑">
											<i class="glyphicon glyphicon-edit"></i>
										</a>

										<button class="btn btn-xs btn-danger action-get" data-href="97/remove" data-toggle="tooltip" title="删除" data-confirm="确认删除本条记录吗">
										<i class="glyphicon glyphicon-trash"></i>
									</button>
									</div>
								</td>
							</tr>

						</tbody>

						<!--<tbody>
							<tr class="parent success" data-value="1" data-parent="0">
								<td><input type="checkbox" data-member="pks"></td>
								<td>11111</td>
								<td>22222</td>
								<td>asd33333as</td>
							</tr>
							<tr data-parent="2" data-value="21">
								<td><input type="checkbox" data-member="pks"></td>
								<td>***222</td>
								<td>asdas</td>
								<td>asdas</td>
							</tr>
							<tr class="parent success" data-value="2" data-parent="0">
								<td><input type="checkbox" data-member="pks"></td>
								<td>22222</td>
								<td>22222</td>
								<td>asd33333as</td>
							</tr>

							<tr data-parent="1">
								<td><input type="checkbox" data-member="pks"></td>
								<td>****1111</td>
								<td>asdas</td>
								<td>asdas</td>
							</tr>
							<tr data-parent="1">
								<td><input type="checkbox" data-member="pks"></td>
								<td>****111</td>
								<td>asdas</td>
								<td>asdas</td>
							</tr>
							<tr class="parent success" data-value="3" data-parent="0">
								<td><input type="checkbox" data-member="pks"></td>
								<td>333</td>
								<td>asdas</td>
								<td>asdas</td>
							</tr>
							<tr data-parent="3">
								<td><input type="checkbox" data-member="pks"></td>
								<td>***333</td>
								<td>asdas</td>
								<td>asdas</td>
							</tr>
							<tr data-parent="1">
								<td><input type="checkbox" data-member="pks"></td>
								<td>***111</td>
								<td>asdas</td>
								<td>asdas</td>
							</tr>
							<tr data-parent="2">
								<td><input type="checkbox" data-member="pks"></td>
								<td>****222</td>
								<td>asdas</td>
								<td>asdas</td>
							</tr>

						</tbody>-->
					</table>
				</div>
			</div>
		</div>
	</body>

</html>